#include <cstdio>

int main() {
    int sum_a = 0, sum_b = 0;
    int N;
    int a, a_num, b, b_num;
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d%d%d%d", &a, &a_num, &b, &b_num);
        int sum = a + b;
        if ((sum != a_num && sum != b_num) || (sum == a_num && sum == b_num)) continue;
        else if (sum == a_num) sum_b += 1;
        else if (sum == b_num) sum_a += 1;
    }

    printf("%d %d\n", sum_a, sum_b);

    return 0;
}